import React, {FC, useRef, useState} from "react";

interface User {
    name: string;
    num?: number
}

const ArticleList: FC = (props: any) => {

    const [user, setUser] = useState<User>({
        name: "张三"
    })

    const clickHandle = (e: any, text: any) => {
        console.log(e, text)
        setUser((user) => {
            return {
                ...user,
                num: Math.round(Math.random() * 100)
            }
        })
    }

    return (
        <div className="contact">
            <div className="container">
                <div>
                    { JSON.stringify(user) }
                </div>
                <button onClick={clickHandle.bind('999', this)}>点击1</button>
                <button onClick={(e) => clickHandle(e, '6666')}>点击2</button>
            </div>
        </div>
    );
}
export default ArticleList;
